package trash.Test;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;

public class ReflectionTest
{
    public static void main(String[] args)
    {
        for (Field field : ReflectionTest.class.getDeclaredFields())
            System.out.println("Field: " + field.getName() + " Type: " + field.getType().getCanonicalName());

        for (Method method : ReflectionTest.class.getDeclaredMethods())
        {
            Parameter[] parameters = method.getParameters();
            System.out.print("Method: " + method.getName() + " Return Type: " + method.getReturnType().getCanonicalName());
            System.out.print(" Params: ");
            for (Parameter p : parameters)
                System.out.print(p.getType().getCanonicalName() + " " +  p.getName() + ", ");
            System.out.println();
        }
    }

    public static int sqr(int x)
    {
        return x * x;
    }

    public void println()
    {
        System.out.println();
    }

    public static int sval = 5;
    public int objval = 10;
}
